<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="x" uri="/x" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${r'${pageContext.request.contextPath}'}"/>
<html>
<head>
    <meta charset="UTF-8">
    <title>${model_name}</title>
    <link rel="stylesheet" href="${r'${ctx}/layui/css/layui.css'}"  media="all">
</head>
<body>
<div class="layui-container" style="width: 100%">


    <blockquote class="layui-elem-quote">
        <form class="layui-form layui-form-pane" action="" id="${model_name_entity}_form">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">${model_key}</label>
                    <div class="layui-input-inline">
                        <input type="text" name="_EQ_${model_key}"  placeholder="请输入" autocomplete="off" class="layui-input">
                    </div>
                </div>


                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn"  id="${model_name_entity}_search">查询</button>
                        <button  class="layui-btn layui-btn-primary" id="${model_name_entity}_reset">重置</button>
                    </div>
                </div>
            </div>
        </form>


    </blockquote>

    <blockquote class="layui-elem-quote layui-quote-nm">
        <div class="layui-btn-group">
            <div class="layui-btn-group">
                <button class="layui-btn layui-btn-small" id="btn_add">
                    <i class="layui-icon">&#xe654;</i>
                </button>
                <button class="layui-btn layui-btn-small" id="btn_edit">
                    <i class="layui-icon">&#xe642;</i>
                </button>
                <button class="layui-btn layui-btn-small" id="btn_delete">
                    <i class="layui-icon">&#xe640;</i>
                </button>
                <button class="layui-btn layui-btn-small" id="btn_view">
                    <i class="layui-icon">&#xe63c;</i>
                </button>
            </div>
        </div>
    </blockquote>
</div>

<table  id="${model_name_entity}_elem" lay-filter="${model_name_entity}_filter" ></table>
<script type="text/javascript" src="${r'${ctx}'}/layui/layui.js"></script>
<script>

    layui.config({
        base: '/layui/larrylib/'
    }).extend({
        tools:'tools',

    });
    function reloadTable(){
        layui.use(['table','jquery','layer','tools'], function(){
            var table = layui.table;
            table.reload('${model_name_entity}_id');
        });
    }
    layui.use(['table','jquery','layer','tools','form'], function(){
        var table = layui.table,
                tools = layui.tools,
                $ = layui.jquery;

        var jsonObj = $("#${model_name_entity}_form").serializeObject();
        table.render({
            elem: '#${model_name_entity}_elem'
            ,id:"${model_name_entity}_id"
            ,url: '/${model_name_entity}/query'
            ,method:'post'
            ,width: '100%'
            ,limits: [10,15,20,30,50,100]
            ,limit: 15
            ,where:jsonObj
            ,even: true
            ,cols: [[
                {checkbox: true, fixed: true}
                ,{field:'roleStdCode', title: '角色类型编码', width:120,fixed: true}
                ,{field:'roleStdName', title: '角色类型名称', width:120, sort: true}
                ,{field:'roleStdDesc', title: '角色类型描述', width:240, sort: true}

            ]]
            ,page: true
            ,height: 475
        });
        $("#btn_view").click(function(){
            var args = {"id":"${model_name_entity}_id","status":"view","fn":"setOriginInfo","keys":"${model_key}"};
            tools.openWin(args);
        });
        $("#btn_edit").click(function(){
            var args = {"id":"${model_name_entity}_id","fn":"setOriginInfo","keys":"${model_key}"};
            tools.openWin(args);
        });
        $("#btn_add").click(function(){
            var args = {"id":"${model_name_entity}_id","fn":"setOriginInfo","status":"add"};
            tools.openWin(args);
        });
        $("#${model_name_entity}_reset").click(function(){
            $("#${model_name_entity}_form")[0].reset();
            var jsonObj = $("#${model_name_entity}_form").serializeObject();
            table.reload('${model_name_entity}_id',{where:jsonObj});
            return false;
        });
        $("#${model_name_entity}_search").click(function(){
            var jsonObj = $("#${model_name_entity}_form").serializeObject();
            table.reload('${model_name_entity}_id',{where:jsonObj});
            return false;
        });
    });
</script>
</body>
</html>
